package com.mq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Deprecated
@Configuration
public class DirectConfig {
    /**
     * 声明交换机
     * @return Direct类型交换机
     */
    @Bean
    public DirectExchange directExchange(){
        return ExchangeBuilder.directExchange("hmall.direct").build();
    }
    @Bean
    public Queue directQueue1(){
        return new Queue("direct.queue1");
    }
//    @Bean
    public Binding bindingQueue1WithRed(){
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("red");
    }
//    @Bean
    public Binding bindingQueue1WithBlue(){
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("blue");
    }

//    @Bean
    public Queue directQueue2(){
        return new Queue("direct.queue2");
    }

//    @Bean
    public Binding bindingQueue2WithRed(){
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("red");
    }
//    @Bean
    public Binding bindingQueue1WithYellow(){
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("yellow");
    }
}
